﻿@model IEnumerable<YHWE.Web.Models.channel>

@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/powerManage/Views/Shared/manage.cshtml";
}

<h2>频道管理</h2>

<p>
    @Html.ActionLink("新建频道", "Create")
</p>

<table style="width:100% !important;" >
    <tr>
        <th style="width:180px"></th>
        <th>
            频道名
        </th>

        <th>
            可见性
        </th>
        <th>
            创建时间
        </th>
        <th>
            处理
        </th>
    </tr>

@foreach (var item in Model)
{
        <tr style="background:#f0f0f0">
            <td>
                @Html.ActionLink("编辑", "Edit", new { id=item.ID  }) 
                @if (!item.channel_sub.Any())
	            {    
                    @("| ")                
                    @Html.ActionLink("删除", "Delete", new { id = item.ID })
                }
            </td>
            <td title="@item.exp">
                @item.name
            </td>

            <td>
                @(item.able?"√":"" )
            </td>
            <td>
                @String.Format("{0:g}", item.createDate)
            </td>
            <td>
                @if (item.parentID == null)
                {
                @Html.ActionLink("增加子频道", "Create", new { id = item.ID })
                }
            </td>
        </tr>
    if (item.channel_sub != null)
    {
     
                  foreach (var subItem in item.channel_sub)
                  { 
                        <tr>
                            <td style="padding-left:80px">
                                @Html.ActionLink("编辑", "Edit", new { id = subItem.ID }) |
                                @Html.ActionLink("删除", "Delete", new { id = subItem.ID })
                            </td>
                            <td title="@subItem.exp">
                                @subItem.name
                            </td>

                            <td>
                                @(subItem.able ? "√" : "")
                            </td>
                            <td>
                                @String.Format("{0:g}", subItem.createDate)
                            </td>
                            <td>
                            </td>
                        </tr>
                  }

    }

}

</table>